package com.cxdr.awsips.common.thread;

import com.cxdr.awsips.common.bean.Thread_log;

public abstract class BaseProcessor extends Thread {
	private boolean isFinished = false;
	private String thread_name;
	private String task_name;
	
	public synchronized void finish(){
		isFinished = true;
	}
	public synchronized boolean isFinish(){
		return isFinished;
	}
	
	public Thread_log getLog(){
		Thread_log log = new Thread_log();
		log.setId(String.valueOf(this.getId()));
		log.setTask_name(task_name);
		log.setThread_name(thread_name);
		log.setThread_state(this.getState().name());
		return log;
	}
	protected void regPool(){
		ThreadRecorder.reg(getId(), this);
	}
	@Override
	abstract public void run();
	
	public String getThread_name() {
		return thread_name;
	}
	public void setThread_name(String thread_name) {
		this.thread_name = thread_name;
	}
	public String getTask_name() {
		return task_name;
	}
	public void setTask_name(String task_name) {
		this.task_name = task_name;
	}
}
